package com.maple.myormsqlite.sub_sqlite;

import com.maple.myormsqlite.bean.User;
import com.maple.myormsqlite.db.BaseDaoFactory;

import java.io.File;

public enum  PrivateDataBaseEnums {
    DATEBASE("");  //实例对象
    private String value;  //属性
    PrivateDataBaseEnums(String value) {
    }

    //用于产生路径
    public String getValue(){
        UserDao userDao = BaseDaoFactory.getOurInstance().getBaseDao(UserDao.class, User.class);
        if(userDao != null){
            User currentUser = userDao.getCurrentUser();
            if(currentUser != null){
                File file = new File("data/data/com.maple.myormsqlite");
                if(!file.exists()){
                    file.mkdirs();
                }
                //path = data/data/com.maple.myormsqlite/N001_login.db
                return file.getAbsolutePath() + "/" + currentUser.getId() + "_login.db";
            }
        }
        return null;
    }


}
